<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./Promise.js"></script>
</head>
<body>
    <h1>06-Promise中catch方法实现</h1>

    <script>
         
        // 实例化一个自定义的Promise对象
        const p = new Promise((resolve, reject) => {
            setTimeout(()=>{
                reject("error"); //失败
            },1000);
                
        });

        // promise对象调用then方法后会继续返回一个新的promise对象
        p.catch(r => {
            console.log("失败的catch处理：", r);
        });

    
        

    </script>
</body>
</html>